package day20170414.homework.dao.impl;

import day20170414.homework.dao.StudentDao;
import day20170414.homework.entity.StudentEntity;

public abstract class StudentDaoBasicImpl implements StudentDao {
	
	/**
	 * 学生判断
	 * @param oldArrays	老的学生对象数组
	 */
	@Override
	public int studentGudge(StudentEntity[] oldArrays,String name){
		for(int index=0; index<oldArrays.length ;index++){
			//拿到这位学生对象
			StudentEntity stu = oldArrays[index];
			//防止空指针
			if(stu != null){
				//拿到学生的名字
				String value = stu.getName();
				if(name.equals(value)){
					//找到学生返回下标
					return index;
				}
			}
		}
		//如果不存在返回-1
		return -1;
	}

}
